<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div>
			<table>
				<tr>
					<td colspan="2"><img src="../IMG/P62JXYYQ5BW90RMC~8FUF)I.jpg"/> </td>
					<td colspan="2" tyle="font-size:25px;">购物简易计算器</td>
				</tr>
				<!--第一个数-->
				<tr>
					<td colspan="2">第一个数：</td>
					<td colspan="2"><input type="text" id="inputId1" /> </td>
				</tr>
				<!--第二个数-->
				<tr>
					<td colspan="2">第二个数：</td>
					<td colspan="2"><input type="text" id="inputId2"/> </td>
				</tr>
				<!--符号-->
				<tr>
					<td><input type="button" value="+" onclick="add()" /> </td>
					<td><input type="button" value="-" onclick="sub()" /> </td>
					<td><input type="button" value="*" onclick="ride()"/> </td>
					<td><input type="button" value="/" onclick="div()"/> </td>
				</tr>
				<tr>
					<td colspan="2">计算结果：</td>
					<td colspan="2"><input type="text" id="inputId3" /> </td>
				</tr>
			</table>
		</div>
	</body>
	<style type="text/css"></style>
	<script type="text/javascript">
//		加
		function add(){
			var input1 = document.getElementById("inputId1").value;
			var input2 = document.getElementById("inputId2").value;
			var input3 = document.getElementById("inputId3");
			var add = parseInt(input1) + parseInt(input2);
			input3.value = add;
			console.log(input3);
		}
//		减
		function sub(){
			var input1 = document.getElementById("inputId1").value;
			var input2 = document.getElementById("inputId2").value;
			var input3 = document.getElementById("inputId3");
			var sub = parseInt(input1) - parseInt(input2);
			input3.value = sub;
		}
//		乘
		function ride(){
			var input1 = document.getElementById("inputId1").value;
			var input2 = document.getElementById("inputId2").value;
			var input3 = document.getElementById("inputId3");
			var ride = parseInt(input1) * parseInt(input2);
			input3.value = ride;
		}
		function div(){
			var input1 = document.getElementById("inputId1").value;
			var input2 = document.getElementById("inputId2").value;
			var input3 = document.getElementById("inputId3");
			var div = parseInt(input1) / parseInt(input2);
			input3.value = div;
		}
	</script>
</html>
